/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.organization.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import queenb.net.entitybean.N400;
import queenb.web.organization.inf.N400Inf;
import queenb.web.util.PackageContants;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;

import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;

/**
 *
 * @author Nguyen Hung
 */
public class N400Store extends N400 implements N400Inf {

    @Override
    public int INSERTTABN400(int pnPN400, int pnFC250, int pnFN850, Date pdND401, String pvNV402, String pvNV403, String pvNV404, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_N400, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN400),
                        new Param(OracleTypes.INTEGER, pnFC250),
                        new Param(OracleTypes.INTEGER, pnFN850),
                        new Param(OracleTypes.DATE, pdND401),
                        new Param(OracleTypes.CHAR, pvNV402),
                        new Param(OracleTypes.CHAR, pvNV403),
                        new Param(OracleTypes.CHAR, pvNV404),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, N400.class);
        } catch (SQLException ex) {
            Logger.getLogger(N400Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<N400> LISTOFTABN400(int pnFH000, int pnFH200, Date pdND401, int pnFC250, int pnFN450,int pnFN850, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_N400, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.DATE, pdND401),
                        new Param(OracleTypes.INTEGER, pnFC250),
                        new Param(OracleTypes.INTEGER, pnFN450),
                        new Param(OracleTypes.INTEGER, pnFN850),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, N400.class);
        } catch (SQLException ex) {
            Logger.getLogger(N400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N400Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
